package zth;



import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.SQLException;

public class delete extends HttpServlet {

    private static final long serialVersionUID = 1198763442666686380L;

    public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
        this.doPost(request, response);
    }

    public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException {
        String account = request.getParameter("account");
        String sql = "DELETE FROM informtion WHERE account=" + account;
//        PrintWriter writer = response.getWriter();
//        writer.println("hera!");
//        writer.flush();//ok！


        try {
            DBUtils.delete(sql);
            response.sendRedirect("./listservlet");
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }

}
